'''
Created on Sep 29, 2011

@author: f13
'''

import logging, Config

config = Config.config

class Logger():
    def __init__(self):
        # Initialize main logging settings
        self.fileHandler = logging.FileHandler(config.logName, mode='w')
        self.fileHandler.setLevel(config.minLogPriority)
        self.formatter = logging.Formatter('%(levelname)s alert at %(asctime)s, recorded by %(name)s: %(message)s')
        self.fileHandler.setFormatter(self.formatter)
        
        # Initialize Main (root) logger
        self.mainLogger = logging.getLogger(name="Main")
        self.mainLogger.setLevel(1)
        self.mainLogger.addHandler(self.fileHandler)
        
        # Initialize communications logger
        self.communicationsLogger = logging.getLogger("Main.CommunicationManager")
        
        # Initialize device management logger
        self.deviceMgtLogger = logging.getLogger("Main.DeviceManager")
        
        # Initialize packet management logger
        self.packetMgtLogger = logging.getLogger("Main.PacketManager")
        
logger = Logger()